home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1996 / MacHack 1996.toast / Hacks / Hacks ’92 / RISCy Bitsness / cntrl.v next >
Encoding:
Verilog source code  |  1992-06-18  |  1.2 KB  |  79 lines  |  [TEXT/MPS ]

  1. module     cntrl(reset,clock,a,start,rw,ack,near,vras,mras,cas,ma,w);
  2.  
  3.     input     [31: 0]a;
  4.     input            reset, clock;
  5.     input            start, near, rw;
  6.     
  7.     output            ack;
  8.     reg                ack;
  9.     
  10.     output            cas;
  11.     reg                cas;
  12.     
  13.     output            mras;
  14.     reg                mras;
  15.     
  16.     output            vras;
  17.     reg                vras;
  18.     
  19.     output     [ 9: 0]ma;
  20.     reg         [ 9: 0]ma;
  21.     
  22.     output            w;
  23.     reg                w;
  24.     
  25.     always @(negedge reset) begin
  26.         mras = 1;
  27.         vras = 1;
  28.         cas = 1;
  29.         w = 0;
  30.         ack = 1;
  31.     end
  32.     
  33.     always @(posedge clock)
  34.     if (reset && ~start) begin
  35.         if (mras & vras) begin
  36.             ma = a[21:12];
  37.             #1
  38.             case (a[23:22]) 
  39.             0:    mras = 0;
  40.             1:    vras = 0;
  41.             endcase
  42.             @(posedge clock);    // wait 60 nS
  43.             @(posedge clock);
  44.             @(posedge clock);
  45.             @(posedge clock);
  46.             @(posedge clock);
  47.             @(posedge clock);
  48.         end
  49.         w = ~rw;
  50.         ma = a[11:2];
  51.         #1
  52.         cas = 0;
  53.         @(posedge clock);    // wait 40 nS
  54.         @(posedge clock);
  55.         @(posedge clock);
  56.         @(posedge clock);
  57.         if (near) begin
  58.             ack = 0;
  59.             @(posedge clock);    // and 20 more
  60.             ack = 1;
  61.             cas = 1;
  62.             @(posedge clock);
  63.         end else begin
  64.             ack = 0;
  65.             @(posedge clock);    // and 20 more
  66.             ack = 1;
  67.             cas = 1;
  68.             mras = 1;
  69.             vras = 1;
  70.             @(posedge clock);    // wait 80 nS (RAS precharge time)
  71.             @(posedge clock);
  72.             @(posedge clock);
  73.             @(posedge clock);
  74.             @(posedge clock);
  75.             @(posedge clock);
  76.         end
  77.     end
  78.     
  79. endmodule